package com.sy.wz.controller;

import com.sy.wz.entity.po.UserPo;
import com.sy.wz.service.test.TestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Create by wongloong on 17-8-17
 */
@Controller
@RequestMapping("/test")
public class TestController {
    @Autowired
    TestService testService;


    @PostMapping(value = "/add", consumes = "application/json")
    public boolean testAdd(@RequestBody UserPo userPo) {
//        UserPo userPo = new UserPo();
//        userPo.setUsername("haha");
        System.out.println(userPo);
        return testService.insert(userPo);
    }

    @GetMapping(value = "/list")
    public List<UserPo> list() {
//        UserPo userPo = new UserPo();
//        userPo.setUsername("haha");
        return testService.selectByMap(null);
    }
}
